package com.craftplay.service;


import com.craftplay.dao.OrderMapper;
import com.craftplay.model.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {

    @Autowired
    private OrderMapper orderMapper;


    /**
     * 是否付费
     *
     * @return
     */
    public Boolean isPay(Integer userId, Integer unit) {
        List<Order> pay = orderMapper.isPay(userId, unit);
        if (pay == null || pay.size() == 0) return false;
        return true;
    }


    /**
     * 是否付费
     *
     * @return
     */
    public Order selectByOutTradeNo(String outTradeNo) {
        return orderMapper.selectByOutTradeNo(outTradeNo);
    }

}
